const mysql = require('mysql2/promise')

async function checkTableStructure () {
  const connection = await mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'GKL9512357',
    database: 'novel_platform'
  })
  0
  try {
    console.log('检查数据库表结构...')

    // 检查novels表结构
    const [columns] = await connection.execute('DESCRIBE novels')
    console.log('\nnovels表结构:')
    console.table(columns)

    // 检查表中的数据
    const [rows] = await connection.execute('SELECT * FROM novels LIMIT 5')
    console.log('\nnovels表数据示例:')
    console.table(rows)
  } catch (error) {
    console.error('检查失败:', error.message)
  } finally {
    await connection.end()
  }
}

checkTableStructure()
